YNQ  YNQ-1.5.1
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups
cmapi.h
Go to the documentation of this file.
1 /*********************************************************************
2  *
3  * Copyright (c) 2021 by Visuality Systems, Ltd.
4  *
5  *********************************************************************
6  * FILE NAME : $Workfile:$
7  * ID : $Header:$
8  * REVISION : $Revision:$
9  *--------------------------------------------------------------------
10  * DESCRIPTION : Entire CM - Common library functionality
11  *--------------------------------------------------------------------
12  * MODULE : NQ
13  * DEPENDENCIES :
14  ********************************************************************/
15 
16 #ifndef _CMAPI_H_
17 #define _CMAPI_H_
18 
19 #include "syapi.h" /* system-dependent */
20 #include <cmcommon.h> /* basic types */
21 #include <cmparams.h> /* parameters */
22 #include <cmutils.h> /* more common functionality for all modules */
23 #include <cmlist.h> /* linked list */
24 #include <cmmemory.h> /* dynamic memory */
25 #include <cmselfip.h> /* IP configuration */
26 #include <cmresolver.h> /* name to IP resolver */
27 #include <cmthread.h> /* thread management */
28 #ifdef UD_NQ_INCLUDECODEPAGE
29 #include <cmcp.h> /* Code pages */
30 #endif /* UD_NQ_INCLUDECODEPAGE */
31 #include <cmunicod.h> /* ANSI to UNICODE and v/v */
32 #include <cmstrparse.h> /* string parser */
33 #include <cmstring.h> /* mapping of string manipulation */
34 #include <cmnbapi.h> /* NetBIOS */
35 #include <cmfsapi.h> /* CIFS */
36 #include <cmrpcdef.h> /* DCERPC */
37 #include <cmsdescr.h> /* Security Descriptors */
38 #include <cmvalida.h> /* Validation of cross-dependencies */
39 #include <cmtrace.h> /* traces */
40 #include <cmbufman.h>
41 #ifdef UD_NQ_INCLUDESMBCAPTURE
42 #include <cmcapture.h>
43 #endif /* UD_NQ_INCLUDESMBCAPTURE */
44 #include <udconfig.h>
45 
46 
61 NQ_STATUS cmInit(NQ_UINT32 component);
62 
68 void cmExit(NQ_UINT32 component);
69 
70 #define NQ_CLIENT 0x1
71 #define NQ_SERVER 0x2
72 #define NQ_NDDAEMON 0x4
80 #define NQ_RESOLVER_IPV4 4
81 #define NQ_RESOLVER_IPV6 6
82 #define NQ_RESOLVER_NONE 0
84 #define NQ_RESOLVER_DNS 1
85 #define NQ_RESOLVER_NETBIOS 2
86 #define NQ_RESOLVER_EXTERNAL_METHOD 5
87 #define NQ_RESOLVER_DNS_DC 8
88 #define NQ_RESOLVER_NETBIOS_DC 10
89 #define NQ_RESOLVER_WSD 12
98 #define CM_PRODUCT_STRING_LEN 20
99 
100 /* This struct represents the current product information */
101 typedef struct
102 {
103  NQ_CHAR productName[CM_PRODUCT_STRING_LEN]; /* The product name */
104  NQ_CHAR productType[CM_PRODUCT_STRING_LEN]; /* Client Standalone / Client Corporate / Server Standalone / Server Corporate */
105  NQ_CHAR version[CM_PRODUCT_STRING_LEN]; /* The current product version */
107 } CMProductInfo;
108 
115 typedef struct
116 {
122  NQ_INT (*toAnsi) ( NQ_CHAR* outStr, NQ_UINT outLength, const NQ_WCHAR* inWStr, NQ_UINT inLength);
123  NQ_INT (*toUnicode)( NQ_WCHAR* outWStr, NQ_UINT outLength, const NQ_CHAR* inStr, NQ_UINT inLength);
124  NQ_INT (*toUpper) ( NQ_CHAR* dst, const NQ_CHAR* src);
126  void (*ansiToFs) ( NQ_CHAR* str, NQ_INT size, const NQ_BYTE* firstIllegalChar, const NQ_BYTE* anyIllegalChar, NQ_INT numOfFirstIllChars, NQ_INT numOfAnyIllChars);
128  void (*fsToAnsi) ( NQ_CHAR* str, NQ_INT size, const NQ_BYTE* firstIllegalChar, const NQ_BYTE* anyIllegalChar, NQ_INT numOfFirstIllChars, NQ_INT numOfAnyIllChars);
129 
130  const NQ_WCHAR* a2uTab;
135 }
136 CMCodepage;
137 
145 typedef struct
146 {
147 
162  NQ_STATUS (* requestByName)(SYSocketHandle socket, const NQ_WCHAR * name, void * context,
163  const NQ_IPADDRESS * serverIp, NQ_COUNT * numOfSentRequests);
174  NQ_STATUS (* responseByName)(SYSocketHandle socket, NQ_IPADDRESS ** pAddressArray, NQ_INT * numIps, void ** pContext);
189  NQ_STATUS (* requestByIp)(SYSocketHandle socket, const NQ_IPADDRESS * ip, void * context,
190  const NQ_IPADDRESS * serverIp, NQ_COUNT * numOfSentRequests);
201  NQ_STATUS (* responseByIp)(SYSocketHandle socket, const NQ_WCHAR ** pName, void ** pContext);
214 }
216 
219 /* function prototypes */
220 
246 NQ_BOOL cmCodepageAdd(const CMCodepage * codePage);
247 
261 NQ_BOOL cmCodepageRemove(const CMCodepage * codePage);
262 
267 void cmWideCharToMultiByte(NQ_CHAR *strMultiByte, const NQ_WCHAR* strWideChar);
268 
273 void cmMultiByteToWideChar(NQ_WCHAR* strWideChar, const NQ_CHAR *strMultiByte);
274 
291 typedef void (* CMAbstractHasher)(const NQ_BYTE * dataIn, NQ_BYTE * dataOut, NQ_COUNT length);
292 
318 typedef void (* CMAbstractCipher)(const CMBlob * key, const CMBlob * key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE * buffer, NQ_COUNT bufferSize);
319 
346 typedef void (* CMAbstractIOCipher)(const CMBlob * key, const CMBlob * key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE * buffer, NQ_COUNT bufferSize);
347 
374 typedef void (* CMAbstractHasher512)(const CMBlob * key, const CMBlob * key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_IOBufPos buffer, NQ_COUNT bufferSize, NQ_BYTE *ctxBuff);
375 
405 typedef void (* CMAbstractCcmEncryption)(const CMBlob * key, const CMBlob * key1, const CMIOBlob * prefix, CMIOBlob * message, NQ_BYTE * auth);
406 
434 typedef NQ_BOOL (* CMAbstractCcmDecryption)(const CMBlob * key, const CMBlob * key1, const CMIOBlob * prefix, CMIOBlob * message, const NQ_BYTE * auth);
435 
436 
469 typedef void (* CMAbstractGcmEncryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *encMsgBuffer);
470 
504 typedef NQ_BOOL (* CMAbstractGcmDecryption)(const CMBlob * key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, const NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *msgBuffer);
505 
513 typedef struct
514 {
525 }
527 
534 void cmSetExternalCrypters(const CMCrypterList * crypters);
535 
539 void cmResetExternalCrypters(void);
540 
571 typedef NQ_INT (*CMResolverNameToIpA)(const NQ_CHAR * name, void * ip, NQ_COUNT index);
572 
596 typedef NQ_INT (*CMResolverNameToIp)(const NQ_WCHAR * name, void * ip, NQ_COUNT index);
597 
613 typedef NQ_BOOL (*CMResolverIpToNameA)(NQ_CHAR * name, const void * ip, NQ_INT ipType);
614 
629 typedef NQ_BOOL (*CMResolverIpToName)(NQ_WCHAR * name, const void * ip, NQ_INT ipType);
630 
665 
700 
725 const NQ_WCHAR * cmResolverGetHostName(const NQ_IPADDRESS * ip);
726 
757 const NQ_IPADDRESS * cmResolverGetHostIps(const NQ_WCHAR * dnsList, const NQ_WCHAR * host, NQ_INT * numIps);
758 
785 const NQ_WCHAR * cmResolverGetDCName(const NQ_WCHAR * domain, const NQ_WCHAR * dnsList, NQ_INT * numDCs);
786 
816 void cmResolverEnableMethod(NQ_INT type, NQ_BOOL unicast, NQ_BOOL multicast);
817 
838 
858 
879 void cmDnsSetServersA(const NQ_CHAR * servers);
880 
892 void cmDnsSetServers(const NQ_WCHAR * servers);
893 
904 
911 
930 void cmNetBiosSetWinsA(const NQ_CHAR * servers);
931 
944 void cmNetBiosSetWins(const NQ_WCHAR * servers);
945 
954 
961 
974 NQ_STATUS cmDnsSetDomainA(const NQ_CHAR * domainName);
975 
988 NQ_STATUS cmDnsSetDomain(const NQ_WCHAR * domainName);
989 
1002 
1012 
1015 #endif /* _CMAPI_H_ */
NQ_COUNT cmNetBiosGetNumWinsServers(void)
void cmDnsSetServers(const NQ_WCHAR *servers)
NQ_STATUS cmDnsSetDomainA(const NQ_CHAR *domainName)
CMAbstractCcmEncryption aes128ccmEncryption
Definition: cmapi.h:521
NQ_BOOL(* CMResolverIpToName)(NQ_WCHAR *name, const void *ip, NQ_INT ipType)
Definition: cmapi.h:629
NQ_STATUS cmNetBiosNameReload(void)
CMAbstractHasher512 sha512
Definition: cmapi.h:520
NQ_BOOL cmCodepageRemove(const CMCodepage *codePage)
NQ_STATUS cmInit(NQ_UINT32 component)
unsigned int NQ_UINT
Definition: udapi.h:29
NQ_BOOL cmResolverRegisterExternalMethod(const CMResolverRegisteredMethodDescription *pMethod)
void(* CMAbstractHasher)(const NQ_BYTE *dataIn, NQ_BYTE *dataOut, NQ_COUNT length)
Definition: cmapi.h:291
NQ_IPADDRESS4 cmNetBiosGetWins(NQ_COUNT winsID)
void cmWideCharToMultiByte(NQ_CHAR *strMultiByte, const NQ_WCHAR *strWideChar)
NQ_INT(* CMResolverNameToIp)(const NQ_WCHAR *name, void *ip, NQ_COUNT index)
Definition: cmapi.h:596
void cmResolverEnableMethod(NQ_INT type, NQ_BOOL unicast, NQ_BOOL multicast)
void(* CMAbstractGcmEncryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *encMsgBuffer)
Definition: cmapi.h:469
CMProductInfo * cmGetCurrentProductInformation(void)
Definition: cmapi.h:115
void cmExit(NQ_UINT32 component)
NQ_UINT32 NQ_IPADDRESS4
Definition: udapi.h:49
NQ_STATUS cmDnsSetDomain(const NQ_WCHAR *domainName)
#define SYSocketHandle
Definition: syopsyst.h:331
const NQ_IPADDRESS * cmResolverGetHostIps(const NQ_WCHAR *dnsList, const NQ_WCHAR *host, NQ_INT *numIps)
void cmMultiByteToWideChar(NQ_WCHAR *strWideChar, const NQ_CHAR *strMultiByte)
NQ_UINT NQ_COUNT
Definition: udapi.h:32
NQ_UINT16 NQ_WCHAR
Definition: udapi.h:45
NQ_UINT32 checksum
Definition: cmapi.h:106
unsigned char NQ_BYTE
Definition: udapi.h:27
CMAbstractCipher md5
Definition: cmapi.h:516
const NQ_WCHAR * cmResolverGetHostName(const NQ_IPADDRESS *ip)
#define CM_PRODUCT_STRING_LEN
Definition: cmapi.h:98
CMAbstractHasher md4
Definition: cmapi.h:515
NQ_BOOL(* CMAbstractCcmDecryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, const NQ_BYTE *auth)
Definition: cmapi.h:434
CMAbstractGcmDecryption aes128gcmDecryption
Definition: cmapi.h:524
void(* CMAbstractCcmEncryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, NQ_BYTE *auth)
Definition: cmapi.h:405
NQ_IPADDRESS * cmDnsGetServer(NQ_COUNT dnsID)
void(* CMAbstractCipher)(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE *buffer, NQ_COUNT bufferSize)
Definition: cmapi.h:318
CMAbstractGcmEncryption aes128gcmEncryption
Definition: cmapi.h:523
Definition: udapi.h:138
void cmResolverSetExternalA(CMResolverNameToIpA nameToIp, CMResolverIpToNameA ipToName)
NQ_BOOL(* CMResolverIpToNameA)(NQ_CHAR *name, const void *ip, NQ_INT ipType)
Definition: cmapi.h:613
void cmNetBiosSetWins(const NQ_WCHAR *servers)
void(* CMAbstractIOCipher)(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_BYTE *buffer, NQ_COUNT bufferSize)
Definition: cmapi.h:346
CMAbstractCcmDecryption aes128ccmDecryption
Definition: cmapi.h:522
CMAbstractCipher hmacmd5
Definition: cmapi.h:517
void cmResetExternalCrypters(void)
NQ_BOOL cmResolverUpdateExternalMethodsPriority(NQ_INT requiredPriority)
Definition: cmapi.h:513
int NQ_INT
Definition: udapi.h:28
void cmResolverSetExternal(CMResolverNameToIp nameToIp, CMResolverIpToName ipToName)
Definition: cmapi.h:101
CMAbstractIOCipher sha256
Definition: cmapi.h:518
void(* CMAbstractHasher512)(const CMBlob *key, const CMBlob *key1, const CMIOBlob dataFragments[], NQ_COUNT numFragments, NQ_IOBufPos buffer, NQ_COUNT bufferSize, NQ_BYTE *ctxBuff)
Definition: cmapi.h:374
const NQ_WCHAR * cmResolverGetDCName(const NQ_WCHAR *domain, const NQ_WCHAR *dnsList, NQ_INT *numDCs)
void cmDnsSetServersA(const NQ_CHAR *servers)
void cmSetExternalCrypters(const CMCrypterList *crypters)
void cmNetBiosSetWinsA(const NQ_CHAR *servers)
NQ_BOOL(* CMAbstractGcmDecryption)(const CMBlob *key, const CMBlob *key1, const CMIOBlob *prefix, CMIOBlob *message, const NQ_BYTE *auth, NQ_BYTE *keyBuffer, NQ_BYTE *msgBuffer)
Definition: cmapi.h:504
int NQ_BOOL
Definition: udapi.h:30
NQ_INT(* CMResolverNameToIpA)(const NQ_CHAR *name, void *ip, NQ_COUNT index)
Definition: cmapi.h:571
const NQ_WCHAR * a2uTab
Definition: cmapi.h:130
char NQ_CHAR
Definition: udapi.h:26
NQ_COUNT cmDnsGetNumDnsServers(void)
NQ_BOOL cmCodepageAdd(const CMCodepage *codePage)
NQ_IPADDRESS * serverIP
Definition: cmapi.h:159
unsigned long NQ_UINT32
Definition: udapi.h:43
NQ_UINT32 timeout
Definition: cmapi.h:157
NQ_INT activationPriority
Definition: cmapi.h:148
CMAbstractIOCipher aes128cmac
Definition: cmapi.h:519
NQ_INT NQ_STATUS
Definition: udapi.h:47
NQ_INT id
Definition: cmapi.h:117